package com.eling.elcms.travel.model;

import com.eling.elcms.basedoc.model.PersonalInfo;
import com.eling.elcms.basedoc.model.Room;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancer;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancers;
import com.eling.elcms.core.dao.hibernate.OrderCriteriaEnhancer;
import com.eling.elcms.core.model.BaseModel;
import com.eling.elcms.ordermanager.model.ServicePoint;
import com.eling.elcms.privilege.service.impl.CommonPrivilegeCriteriaEnhancer;
import com.eling.elcms.system.model.CommonUser;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

/**
 *  换房调整  liyan
 *  
 */
@Entity
@Table(name = "travel_changeroom")
@Indexed
@CriteriaEnhancers(criteriaEnhancers = {
		@CriteriaEnhancer(impl = OrderCriteriaEnhancer.class,parameter = "changeRoomDate:desc"),
		@CriteriaEnhancer(impl = CommonPrivilegeCriteriaEnhancer.class, parameter = "servicepoint:servicePoint") })
public class ChangeRoom extends BaseModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1480793231998546957L;
	
	@Id
	@DocumentId
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long pkChangeRoom;
	
	/** 所属服务点*/
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkServicePoint")
    @IndexedEmbedded(depth = 1)
	private ServicePoint servicePoint;
	
	/** 调整日期 */
	@Column
	@Field
	private Date changeRoomDate;//
	
	/** 人员信息 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkPersonalInfo")
	@IndexedEmbedded(depth = 1)
	private PersonalInfo personalInfo;
	
	/** 操作人 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "operator")
	@IndexedEmbedded(depth = 1)
	private CommonUser operator;

	/** 调整前的房间 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkRoom")
	@IndexedEmbedded(depth = 1)
	private Room room;
	
	/** 入住电表*/
	@Column
	@Field
	private Double checkInElectric;
	
	/** 退住电表*/
	@Column
	@Field
	private Double checkOutElectric;
	
	/** 入住冷水表*/
	@Column
	@Field
	private Double checkInColdWater;
	
	/** 退住冷水表*/
	@Column
	@Field
	private Double checkOutColdWater;
	
	/** 入住热水表*/
	@Column
	@Field
	private Double checkInHotWater;
	
	/** 退住热水表*/
	@Column
	@Field
	private Double checkOutHotWater;
	
	/** 人员-房间消费情况 */
	@OneToMany(fetch = FetchType.LAZY)
	@IndexedEmbedded(depth = 1)
	@JoinColumn(name = "pkChangeRoom")
	private Set<RoomPerConsumption> roomPerConsumptions;
	
	@Version
	private Integer version;
	
	public CommonUser getOperator() {
		return operator;
	}

	public void setOperator(CommonUser operator) {
		this.operator = operator;
	}

	public Room getRoom() {
		return room;
	}
	
	public void setRoom(Room room) {
		this.room = room;
	}

	public PersonalInfo getPersonalInfo() {
		return personalInfo;
	}
	
	public void setPersonalInfo(PersonalInfo personalInfo) {
		this.personalInfo = personalInfo;
	}

	public Long getPkChangeRoom() {
		return pkChangeRoom;
	}

	public void setPkChangeRoom(Long pkChangeRoom) {
		this.pkChangeRoom = pkChangeRoom;
	}

	public ServicePoint getServicePoint() {
		return servicePoint;
	}

	public void setServicePoint(ServicePoint servicePoint) {
		this.servicePoint = servicePoint;
	}

	public Date getChangeRoomDate() {
		return changeRoomDate;
	}

	public void setChangeRoomDate(Date changeRoomDate) {
		this.changeRoomDate = changeRoomDate;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public Double getCheckInElectric() {
		return checkInElectric;
	}

	public void setCheckInElectric(Double checkInElectric) {
		this.checkInElectric = checkInElectric;
	}

	public Double getCheckOutElectric() {
		return checkOutElectric;
	}

	public void setCheckOutElectric(Double checkOutElectric) {
		this.checkOutElectric = checkOutElectric;
	}

	public Double getCheckInColdWater() {
		return checkInColdWater;
	}

	public void setCheckInColdWater(Double checkInColdWater) {
		this.checkInColdWater = checkInColdWater;
	}

	public Double getCheckOutColdWater() {
		return checkOutColdWater;
	}

	public void setCheckOutColdWater(Double checkOutColdWater) {
		this.checkOutColdWater = checkOutColdWater;
	}

	public Double getCheckInHotWater() {
		return checkInHotWater;
	}

	public void setCheckInHotWater(Double checkInHotWater) {
		this.checkInHotWater = checkInHotWater;
	}

	public Double getCheckOutHotWater() {
		return checkOutHotWater;
	}

	public void setCheckOutHotWater(Double checkOutHotWater) {
		this.checkOutHotWater = checkOutHotWater;
	}

	public Set<RoomPerConsumption> getRoomPerConsumptions() {
		return roomPerConsumptions;
	}

	public void setRoomPerConsumptions(Set<RoomPerConsumption> roomPerConsumptions) {
		this.roomPerConsumptions = roomPerConsumptions;
	}
	
}
